Skip to content

feat(java): workflow dashboard + saga node fields#390

Merged
pratyush618 merged 2 commits into
masterfrom
feat/java-dashboard-workflows
Jul 8, 2026
Merged

feat(java): workflow dashboard + saga node fields#390
pratyush618 merged 2 commits into
masterfrom
feat/java-dashboard-workflows

Conversation

@pratyush618

@pratyush618 pratyush618 commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

Exposes the workflow run/DAG/children read surface to the dashboard, plus the saga compensation fields on workflow nodes.

Native (Rust JNI, NativeWorkflows)

  • listWorkflowRuns(definitionName, state, limit, offset) — run summaries, filtered + paged.
  • getWorkflowRun(runId) — a single run summary.
  • getWorkflowChildren(runId) — sub-workflow runs spawned by a run.
  • getWorkflowDag(runId) — the serialized DAG backing a run.
  • NodeView gains the four saga fields (compensation_job_id, compensation_started_at, compensation_completed_at, compensation_error), already on the core WorkflowNode.

Java + dashboard

Wired through NativeWorkflowsQueueBackend (default-throwing for non-workflow backends) → JniQueueBackendTaskito/DefaultTaskito. New WorkflowRunInfo model; NodeSnapshot extended with the saga fields.

Dashboard routes: /api/workflows/runs (list), /api/workflows/runs/<id> (run + nodes), /api/workflows/runs/<id>/dag (edge-enriched for the graph view), /api/workflows/runs/<id>/children.

Tests

DashboardWorkflowTest submits a workflow and asserts the list/detail/DAG/children endpoints. Full Java suite + checkstyle + Spotless + cargo fmt/clippy clean.

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Added workflow run browsing in the Java SDK and dashboard: list runs, fetch a run, list children, and retrieve workflow DAGs.
    • Expanded returned run/node summaries with parent linkage and saga compensation details.
  • Bug Fixes

    • Improved behavior for missing workflow data (returning empty/null responses as appropriate) and returns HTTP 404 for non-existent run/DAG requests.
  • Tests

    • Added dashboard coverage for workflow run listing, run details, children, and DAG responses (including non-existent run cases).

@github-actions github-actions Bot added the rust label Jul 8, 2026
@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This PR adds workflow-run inspection across the JNI boundary, Java SDK, and dashboard API. It also extends workflow status payloads with compensation and parent-linkage fields, and adds dashboard tests for the new read endpoints.

Changes

Workflow Run Inspection Feature

Layer / File(s) Summary
Rust: extend status views and add JNI read endpoints
crates/taskito-java/src/workflows/mod.rs
NodeView and WorkflowRunView gain compensation and parent-run fields; four new JNI functions (listWorkflowRuns, getWorkflowRun, getWorkflowChildren, getWorkflowDag) are exported.
Java native/backend bindings and SPI contract
sdks/java/.../internal/NativeWorkflows.java, sdks/java/.../internal/JniQueueBackend.java, sdks/java/.../spi/QueueBackend.java
Adds native method declarations, delegating JniQueueBackend implementations, and default QueueBackend methods throwing UnsupportedOperationException unless overridden.
Java SDK model and public interface
sdks/java/.../model/WorkflowRunInfo.java, sdks/java/.../workflows/NodeSnapshot.java, sdks/java/.../Taskito.java, sdks/java/.../DefaultTaskito.java
Adds WorkflowRunInfo DTO, extends NodeSnapshot with compensation fields, and adds/implements four Taskito interface methods for run inspection.
Dashboard API mapping and handlers
sdks/java/.../dashboard/api/Contract.java, sdks/java/.../dashboard/api/WorkflowsHandlers.java
Adds Contract.workflowRun and workflowNode mapping helpers and a new WorkflowsHandlers class implementing runs, run, children, and DAG enrichment (dag) endpoints.
Route wiring and tests
sdks/java/.../dashboard/DashboardServer.java, sdks/java/.../dashboard/DashboardWorkflowTest.java
Registers four new /api/workflows/runs routes and adds a test class covering listing, detail, DAG, children, and 404 responses.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant DashboardServer
  participant WorkflowsHandlers
  participant Taskito as Taskito (JniQueueBackend)
  participant Rust as taskito-java JNI

  Client->>DashboardServer: GET /api/workflows/runs/{id}/dag
  DashboardServer->>WorkflowsHandlers: dag(id)
  WorkflowsHandlers->>Taskito: getWorkflowDag(id)
  Taskito->>Rust: getWorkflowDag(handle, runId)
  Rust-->>Taskito: DAG JSON string
  Taskito-->>WorkflowsHandlers: Optional<String>
  WorkflowsHandlers->>WorkflowsHandlers: enrichDag(dagJson, nodes)
  WorkflowsHandlers-->>DashboardServer: enriched dag response
  DashboardServer-->>Client: JSON response
Loading

Possibly related PRs

  • ByteVeda/taskito#331: Introduces the parentRunId/parentNodeName persistence that the new run inspection APIs surface.
  • ByteVeda/taskito#333: Implements sub-workflow execution and parent-linkage recording that produces data shown by the new run and children endpoints.
  • ByteVeda/taskito#335: Adds saga-compensation lifecycle and JNI plumbing whose fields are exposed by the updated node and workflow views.

Suggested labels: tests, workflows

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: Java workflow dashboard support and added saga node fields.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/java-dashboard-workflows

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (3)
sdks/java/src/test/java/org/byteveda/taskito/dashboard/DashboardWorkflowTest.java (1)

25-47: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider covering compensation fields and query filters.

Good coverage of the four endpoints' happy path. Since this PR also adds compensation_job_id/compensation_started_at/compensation_completed_at/compensation_error to Contract.workflowNode, and runs() supports definition_name/state/limit/offset filtering, a follow-up test asserting on these would guard against regressions in the new plumbing.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@sdks/java/src/test/java/org/byteveda/taskito/dashboard/DashboardWorkflowTest.java`
around lines 25 - 47, Extend DashboardWorkflowTest to cover the new workflow
node compensation fields and run filtering support. In the existing
DashboardServer/DashboardClient happy-path test around
listsRunsAndReturnsDetail, add assertions that the run detail payload includes
Contract.workflowNode compensation fields such as compensation_job_id,
compensation_started_at, compensation_completed_at, and compensation_error. Also
add coverage for DashboardClient.runs()/the /api/workflows/runs endpoint with
definition_name, state, limit, and offset filters to verify the query plumbing
returns the expected filtered subset.
crates/taskito-java/src/workflows/mod.rs (1)

125-153: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

Consider a lighter view for bulk run listings.

WorkflowRunView (used previously for the single-run status view) is now also returned as a JSON array for listWorkflowRuns and getWorkflowChildren (Lines 1426, 1467). Each row still includes params/error, which can be an arbitrary, potentially large or sensitive payload. For a dashboard "list runs" table this multiplies exposure/payload size across every row, where a summary typically only needs id/definitionId/state/timestamps.

Consider a slimmer WorkflowRunSummaryView (or Option-gate the raw params) for the list/children endpoints, keeping the full params/error for the single-run detail lookup.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@crates/taskito-java/src/workflows/mod.rs` around lines 125 - 153,
`WorkflowRunView` is being reused for bulk listing endpoints, so the
list/children JSON unnecessarily includes large or sensitive `params` and
`error` fields on every row. Introduce a slimmer view such as
`WorkflowRunSummaryView` for `listWorkflowRuns` and `getWorkflowChildren` that
keeps only the summary fields (id, definition_id, state, timestamps, and parent
metadata), while preserving `WorkflowRunView` with full details for the
single-run status path. Update the conversions/return types near
`WorkflowRunView` and the list/children handlers to use the new summary type.
sdks/java/src/main/java/org/byteveda/taskito/Taskito.java (1)

296-307: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Consider typing listWorkflowRuns’s state filter as WorkflowState. The backend already uses the enum’s lowercase wire form, so this keeps the public API aligned with WorkflowRunInfo.state and prevents invalid values from reaching the native layer. DefaultTaskito can pass state == null ? null : state.wire().

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@sdks/java/src/main/java/org/byteveda/taskito/Taskito.java` around lines 296 -
307, Update the public Taskito API so `listWorkflowRuns` uses `WorkflowState`
for the `state` filter instead of `String`, aligning it with
`WorkflowRunInfo.state` and preventing invalid values from being passed through.
Adjust the `Taskito` interface and the `DefaultTaskito.listWorkflowRuns`
implementation to convert the enum to its wire value with `state == null ? null
: state.wire()`, while keeping the null-no-filter behavior intact.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@sdks/java/src/main/java/org/byteveda/taskito/dashboard/api/WorkflowsHandlers.java`:
- Around line 27-39: The runs handler is parsing limit and offset with the local
longParam helper, which throws on malformed values and bubbles up as a 500.
Update WorkflowsHandlers.runs to use the shared Http.longParam parser for both
parameters so invalid query values are handled consistently as a 400, and keep
the rest of the listWorkflowRuns flow unchanged.

---

Nitpick comments:
In `@crates/taskito-java/src/workflows/mod.rs`:
- Around line 125-153: `WorkflowRunView` is being reused for bulk listing
endpoints, so the list/children JSON unnecessarily includes large or sensitive
`params` and `error` fields on every row. Introduce a slimmer view such as
`WorkflowRunSummaryView` for `listWorkflowRuns` and `getWorkflowChildren` that
keeps only the summary fields (id, definition_id, state, timestamps, and parent
metadata), while preserving `WorkflowRunView` with full details for the
single-run status path. Update the conversions/return types near
`WorkflowRunView` and the list/children handlers to use the new summary type.

In `@sdks/java/src/main/java/org/byteveda/taskito/Taskito.java`:
- Around line 296-307: Update the public Taskito API so `listWorkflowRuns` uses
`WorkflowState` for the `state` filter instead of `String`, aligning it with
`WorkflowRunInfo.state` and preventing invalid values from being passed through.
Adjust the `Taskito` interface and the `DefaultTaskito.listWorkflowRuns`
implementation to convert the enum to its wire value with `state == null ? null
: state.wire()`, while keeping the null-no-filter behavior intact.

In
`@sdks/java/src/test/java/org/byteveda/taskito/dashboard/DashboardWorkflowTest.java`:
- Around line 25-47: Extend DashboardWorkflowTest to cover the new workflow node
compensation fields and run filtering support. In the existing
DashboardServer/DashboardClient happy-path test around
listsRunsAndReturnsDetail, add assertions that the run detail payload includes
Contract.workflowNode compensation fields such as compensation_job_id,
compensation_started_at, compensation_completed_at, and compensation_error. Also
add coverage for DashboardClient.runs()/the /api/workflows/runs endpoint with
definition_name, state, limit, and offset filters to verify the query plumbing
returns the expected filtered subset.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 50935558-9f5a-4d0a-be7f-fa3e78cc2e21

📥 Commits

Reviewing files that changed from the base of the PR and between 8534309 and b2603a0.

📒 Files selected for processing (12)
  • crates/taskito-java/src/workflows/mod.rs
  • sdks/java/src/main/java/org/byteveda/taskito/DefaultTaskito.java
  • sdks/java/src/main/java/org/byteveda/taskito/Taskito.java
  • sdks/java/src/main/java/org/byteveda/taskito/dashboard/DashboardServer.java
  • sdks/java/src/main/java/org/byteveda/taskito/dashboard/api/Contract.java
  • sdks/java/src/main/java/org/byteveda/taskito/dashboard/api/WorkflowsHandlers.java
  • sdks/java/src/main/java/org/byteveda/taskito/internal/JniQueueBackend.java
  • sdks/java/src/main/java/org/byteveda/taskito/internal/NativeWorkflows.java
  • sdks/java/src/main/java/org/byteveda/taskito/model/WorkflowRunInfo.java
  • sdks/java/src/main/java/org/byteveda/taskito/spi/QueueBackend.java
  • sdks/java/src/main/java/org/byteveda/taskito/workflows/NodeSnapshot.java
  • sdks/java/src/test/java/org/byteveda/taskito/dashboard/DashboardWorkflowTest.java

@pratyush618

Copy link
Copy Markdown
Collaborator Author

Addressed in 4f515c1: WorkflowsHandlers.runs now routes limit/offset through the shared Http.longParam, so malformed values return 400 instead of a 500. Resolving the thread.

@pratyush618 pratyush618 self-assigned this Jul 8, 2026
New NativeWorkflows read bindings (listWorkflowRuns, getWorkflowRun, getWorkflowChildren, getWorkflowDag) and the four saga compensation fields on the node view/NodeSnapshot. Dashboard gains /api/workflows/runs, /runs/{id}, /runs/{id}/dag (edge-enriched), /runs/{id}/children. New WorkflowRunInfo model.
Addresses PR review: WorkflowsHandlers.runs used a local longParam that 500'd on malformed limit/offset; route through Http.longParam so bad input returns 400.
@pratyush618
pratyush618 force-pushed the feat/java-dashboard-workflows branch from 4f515c1 to d487449 Compare July 8, 2026 04:03
@pratyush618 pratyush618 changed the title feat(java): workflow dashboard reads + saga node fields feat(java): workflow dashboard + saga node fields Jul 8, 2026
@pratyush618
pratyush618 merged commit 07d8029 into master Jul 8, 2026
36 checks passed
@pratyush618
pratyush618 deleted the feat/java-dashboard-workflows branch July 8, 2026 04:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant